import type * as Auth from "./type"
import { request } from "@/http/axios"

/** 获取登录验证码 */
// export function getCaptchaApi() { // 注释掉，因为后端没有验证码功能
//   return request<Auth.CaptchaResponseData>({
//     url: "auth/captcha",
//     method: "get"
//   })
// }

/** 登录并返回 Token */
export function loginApi(data: Auth.LoginRequestData) {
  return request<Auth.LoginResponseData>({
    url: "auth/login",
    method: "post",
    data
  })
}

/** 注册用户 */
export function registerApi(data: Auth.RegisterRequestData) {
  return request<Auth.LoginResponseData>({
    url: "auth/register",
    method: "post",
    data
  })
}

/** 获取用户信息 */
export function getUserInfoApi() {
  return request<Auth.UserInfoResponseData>({
    url: "auth/me",
    method: "get"
  })
}
